home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1567 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: news.iag.net!news
  2. From: jatmon@iag.net (John R Buchan)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Comma Delimited function wanted
  5. Date: 15 Jan 1996 03:05:37 GMT
  6. Organization: Internet Access Group, Orlando, Florida
  7. Message-ID: <4dcga1$f52@news.iag.net>
  8. References: <4d1l42$mb6@voyager.Internex.NET> <4d4gic$p7u@umbc9.umbc.edu> <4d6gi2$g4r@news.iag.net> <821492481snz@genesis.demon.co.uk>
  9. NNTP-Posting-Host: pm4-orl28.iag.net
  10. X-Newsreader: WinVN 0.99.7
  11.  
  12. In article <821492481snz@genesis.demon.co.uk>, fred@genesis.demon.co.uk 
  13. says...
  14. ->
  15. ->In article <4d6gi2$g4r@news.iag.net> jatmon@iag.net "John R Buchan" writes:
  16. ->
  17. ->>  char *buffer = "3740067099,,P03,5000";  
  18. ->>
  19. ->>A strtok based solution will have a similar problem.  A full solution to 
  20. ->>this type of parsing will require a non-standard function (custom code).
  21. ->
  22. ->I don't recommend passing pointers to string literals as strtok's first
  23. ->argument. If a token exists strtok will attempt to modify the string
  24. ->by null character terminating the token. With string literals this
  25. ->results in undefined behaviour. better would be:
  26. ->
  27. ->  static char buffer[] = "3740067099,,P03,5000";  
  28.  
  29. Heh, heh.  I wasn't recommending passing this to strtok.  I was just making 
  30. the point that strtok would have the same kind of problems with a string of 
  31. this type.  However, you are, of course, quite correct.  
  32.  
  33. Actually, I've pointed this out in several other posts this week. I don''t 
  34. know how I managed to miss it here.  Oh well, Murphy prevails.  :-)
  35.  
  36. Thanks for the correction.
  37.  
  38. -- 
  39. John R Buchan           -:|:-     Looking for that elusive FAQ?  ftp to:
  40. jatmon@mail.iag.net     -:|:-     rtfm.mit.edu /pub/usenet-by-group/....
  41.  
  42.